package itsm.isperp.workflow.dto;

import org.activiti.engine.impl.persistence.entity.SuspensionState;
import org.activiti.engine.repository.ProcessDefinition;

/**
 * 
 * 流程定义的实体成熟对象
 * 
 * @author lizx
 * @date 2013-6-29
 * 
 */
public class ProcessDefinitionDTO implements ProcessDefinition {

	protected String id;
	protected String name;

	protected String description;
	protected String key;
	protected int revision = 1;
	protected int version;
	protected String category;
	protected String deploymentId;
	protected String resourceName;
	protected Integer historyLevel;
	protected String diagramResourceName;
	protected boolean isGraphicalNotationDefined;
	protected boolean hasStartFormKey;
	protected int suspensionState;
	protected String tenantId;

	public ProcessDefinitionDTO() {

	}

	public ProcessDefinitionDTO(ProcessDefinition pd) {
		this.id = pd.getId();
		this.name = pd.getName();
		this.description = pd.getDescription();
		this.key = pd.getKey();
		this.revision = pd.getVersion();
		this.version = pd.getVersion();
		this.category = pd.getCategory();
		this.deploymentId = pd.getDeploymentId();
		this.resourceName = pd.getResourceName();

		this.diagramResourceName = pd.getDiagramResourceName();
		this.hasStartFormKey = pd.hasStartFormKey();
		this.isGraphicalNotationDefined = pd.hasGraphicalNotation();
		this.tenantId = pd.getTenantId();
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public int getRevision() {
		return revision;
	}

	public void setRevision(int revision) {
		this.revision = revision;
	}

	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public String getDeploymentId() {
		return deploymentId;
	}

	public void setDeploymentId(String deploymentId) {
		this.deploymentId = deploymentId;
	}

	public String getResourceName() {
		return resourceName;
	}

	public void setResourceName(String resourceName) {
		this.resourceName = resourceName;
	}

	public Integer getHistoryLevel() {
		return historyLevel;
	}

	public void setHistoryLevel(Integer historyLevel) {
		this.historyLevel = historyLevel;
	}

	public String getDiagramResourceName() {
		return diagramResourceName;
	}

	public void setDiagramResourceName(String diagramResourceName) {
		this.diagramResourceName = diagramResourceName;
	}

	public boolean isGraphicalNotationDefined() {
		return isGraphicalNotationDefined;
	}

	public void setGraphicalNotationDefined(boolean isGraphicalNotationDefined) {
		this.isGraphicalNotationDefined = isGraphicalNotationDefined;
	}

	public boolean isHasStartFormKey() {
		return hasStartFormKey;
	}

	public void setHasStartFormKey(boolean hasStartFormKey) {
		this.hasStartFormKey = hasStartFormKey;
	}

	public int getSuspensionState() {
		return suspensionState;
	}

	public void setSuspensionState(int suspensionState) {
		this.suspensionState = suspensionState;
	}

	@Override
	public boolean isSuspended() {
		return suspensionState == SuspensionState.SUSPENDED.getStateCode();
	}

	@Override
	public boolean hasStartFormKey() {
		return this.hasStartFormKey;
	}

	@Override
	public String getTenantId() {
		return this.tenantId;
	}

	@Override
	public boolean hasGraphicalNotation() {
		return isGraphicalNotationDefined;
	}
}
